# -*- coding: utf-8 -*-
# @Time    : 2021/11/13 20:13
# @Author  : travel2040
# @Email   : travel2040@163.com
# @File    : socket-获取域名对应ip地址.py

import socket

data = [
    ("https","www.baidu.com"),
    ("https","www.jd.com"),
    ("http","cdn.tongbao.zhongan.com"),

]
for protocal_type,host in data:
    print(protocal_type,host)
    res = socket.getaddrinfo(host, protocal_type)
    ip = res[0][-1][0]
    print(ip)
    print("============")


